/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.furb.trabalhoFinal.Strategy;

import java.io.*;
import javax.swing.JFileChooser;

/**
 *
 * @author Usuario
 */
public class ArquivoTextoStrategy implements SaidaStrategy{

  @Override
  public void gerarFolha(String folha) {
    try{
      JFileChooser jfc = new JFileChooser();
      if (jfc.showSaveDialog(null) == JFileChooser.APPROVE_OPTION){
        FileOutputStream out;
        PrintStream p;
        out = new FileOutputStream(jfc.getSelectedFile().getName());
        p = new PrintStream(out);
        p.write(folha.getBytes());
        p.close();
      }
    } catch(Exception e) {
      System.err.println(e);
    } 
  }

}
